[OpenWrt Wiki] LuCI 要点 您所在的位置:网站首页 openwrt切换中文 命令行 [OpenWrt Wiki] LuCI 要点

[OpenWrt Wiki] LuCI 要点

2023-07-05 11:16| 来源: 网络整理| 查看: 265

LuCI 要点

This article relies on the following:

Accessing web interface / command-line interface Managing configs / packages / services / logs 如果你不熟悉 命令行界面, 可查询 命令行帮助 和/或 opkg 介绍

虽然 OpenWrt 可以完全使用SSH和终端进行管理,但 LuCI WebUI 使许多管理任务变得更容易。 OpenWrt 完整版本,例如当前的 21.02.x 系列,附带安装了 LuCI WebUI。 但是对于内存较低的设备,例如具有 4MBytes 闪存和/或 32MBytes RAM 的设备,由于缺少足够的闪存,完整安装可能会失败,因此您必须 自行构建 包含 LuCI 的映像。 可以在此处获得更多信息。

指南 安装 在软件库中检索可用软件包的最新列表: opkg update 完整安装一个不需要HTTPS支持的LuCI: opkg install luci 完整安装一个需要HTTPS支持的LuCI: opkg install luci-ssl

OPKG 安装 luci

本地语言支持

基本的LuCI Web用户界面是英文的。但是,您可以搜索并安装其他包以获得本地语言支持。

opkg list luci-i18n-\* //查看可用语言包的列表 opkg install luci-i18n-chinese //安装简体中文

您还可以通过网页界面安装语言包,你可以同时安装多个LuCI语言包,要在它们之间切换可通过网页界面或编辑这个文件 → /etc/config/luci 志愿者们正积极的把它翻译成许多语言。参见translated 。

其他网络应用程序

Search and install luci-app-* packages if you want to configure services via LuCI.

opkg update opkg list luci-app-\* 更换端口

更换端口为:

HTTP - 8080/TCP HTTPS - 8443/TCP uci -q delete uhttpd.main.listen_http uci add_list uhttpd.main.listen_http="0.0.0.0:8080" uci add_list uhttpd.main.listen_http="[::]:8080" uci -q delete uhttpd.main.listen_https uci add_list uhttpd.main.listen_https="0.0.0.0:8443" uci add_list uhttpd.main.listen_https="[::]:8443" uci commit uhttpd /etc/init.d/uhttpd restart 附加功能 详细资料

LuCI做为“元包”安装,它同时安装了其他几个被定义为依赖关系的包。 尤其是,它安装了uHTTPd Web服务器,配置为供LuCI使用。

要使用uHTTPd做Web界面,你仅需要很少的配置就行,因为uHTTPd配置了CGI以使LuCI可以使用Lua解释器来工作。 默认配置如下。默认情况下/www是标准的文档根目录。 因此,通过请求该文档根目录(在浏览器中输入设备IP地址)可以找到一个如index.html的索引文件(uHTTPd设置)。 配备的/www/index.html(与LuCI一起安装)文件会在收到请求时把你重定向到/cgi-bin/luci目录, 这是LuCI的默认CGI通道。这仅是一个脚本,它主要是在/usr/bin/lua中调用Lua。 uHTTPd默认配置为用CGI加载/cgi-bin路径下的页面,从而通过/cgi-bin/luci 脚本为这些网页开启服务。

另外,也可以把Lua作为嵌入式进程来运行LuCI。uHTTPd支持这一点; 可以参考uHTTPd Web服务器配置上uHTTPd的UCI配置的相关文章和章节 。

配置

默认Web服务器uhttpd的配置文件为/etc/config/uhttpd。 该LuCI的Web界面配置文件为/etc/config/luci。

LuCI运行在其他WEB服务器上

→webserver

LuCI 运行在 lighttpd 上

→luci.on.lighttpd

LuCI 运行在 nginx 上

For routers without significant space constraints running on snapshots/master or v19 or later, it is possible to install using nginx. LuCI on nginx is currently supported by using uwsgi as plain-cgi interpreter. You need to install one of this 2 variants of the LuCI meta-package:

luci-nginx - Autoinstall nginx, uwsgi-cgi and the default config file to make luci work on nginx. luci-ssl-nginx - Autoinstall nginx-ssl, uwsgi-cgi and the default config file to make luci wok on nginx.

It does also create a self-signed certificate for nginx and redirect http traffic to https by default. Note that even when using nginx, exposing the LuCI interface to the Internet or guest networks is not recommended.

Currently LuCI on nginx is fully supported (maybe only in master snapshots for now, as of 16-Feb-2019). If any problem is found, report them to the support forum.

LuCI on BusyBox httpd

If you have a very limited space then you can compile OpenWRT image with BusyBox httpd instead of uhttpd. LUCI works fine but you'll need some manual configuration. Also this setup is not widely used and tested. If any problem is found, report them to the support forum.

离线安装

Download the following packages from the package repository using your platform and release version:

Basic liblua libubus libubus-lua libuci-lua lua luci-base luci-lib-ip luci-lib-jsonc luci-lib-nixio luci-mod-admin-full luci-theme-bootstrap rpcd uhttpd Extended luci luci-app-firewall luci-app-opkg luci-proto-ipv6 luci-proto-ppp

传输(如用SCP)以下列表中的软件包到你的OpenWrt路由器上,放到RAM盘/tmp/luci-offline-packages上

# Upload packages to the router ssh [email protected] mkdir -p /tmp/luci-offline scp *.ipk [email protected]:/tmp/luci-offline   # 用下面命令安装: ssh [email protected] opkg install /tmp/luci-offline/*.ipk   # Clean up ssh [email protected] rm -f -R /tmp/luci-offline

Or use this script bellow. Note, the script assumes you have internet access through the router where you are installing LuCI. If you do not, then you will need to either manually download required .ipk packages, or run the script in two parts. First part till the last done statement to be executed when connected to the internet:

#!/bin/sh   # Exit on error set -e   # Configuration parameters OWRT_USER="root" OWRT_HOST="openwrt.lan" OWRT_TEMP="/tmp/luci-offline"   # Fetch OpenWrt release eval $(ssh openwrt cat /etc/openwrt_release) if [ "${DISTRIB_RELEASE}" = "SNAPSHOT" ] then OWRT_DIR="snapshots" else OWRT_DIR="releases/${DISTRIB_RELEASE}" fi   # LuCI packages and repos OWRT_URL="https://downloads.openwrt.org" OWRT_CORE="libiwinfo libiwinfo-lua" OWRT_COREURL="${OWRT_URL}/${OWRT_DIR}/targets/${DISTRIB_TARGET}/packages" OWRT_BASE="libjson-c2 liblua lua libuci-lua libubus libubus-lua uhttpd rpcd" OWRT_BASEURL="${OWRT_URL}/${OWRT_DIR}/packages/${DISTRIB_ARCH}/base" OWRT_LUCI="luci-base liblucihttp liblucihttp-lua luci-lib-ip luci-lib-nixio \ luci-theme-bootstrap luci-mod-admin-full luci-lib-jsonc luci-mod-status \ luci-mod-system luci-mod-network" OWRT_LUCIURL="${OWRT_URL}/${OWRT_DIR}/packages/${DISTRIB_ARCH}/luci"   # Download packages from repos mkdir -p "${OWRT_TEMP}" for OWRT_REPO in OWRT_CORE OWRT_BASE OWRT_LUCI do OWRT_REPOURL=$(eval echo '${'${OWRT_REPO}'URL}') wget -N -P "${OWRT_TEMP}/${OWRT_REPOURL##*/}" "${OWRT_REPOURL}/Packages" for OWRT_PKG in $(eval echo '${'${OWRT_REPO}'}') do OWRT_PKGFILE="$(sed -n -r -e \ "/^Filename:\s${OWRT_PKG}[.0-9]*_.+\.ipk/s/^.*\s//p" \ "${OWRT_TEMP}/${OWRT_REPOURL##*/}/Packages")" OWRT_PKGURL="${OWRT_REPOURL}/${OWRT_PKGFILE}" wget -N -P "${OWRT_TEMP}" "${OWRT_PKGURL}" done done   # Upload packages to OpenWrt ssh "${OWRT_USER}@${OWRT_HOST}" "mkdir -p ${OWRT_TEMP}" scp "${OWRT_TEMP}/"*.ipk "${OWRT_USER}@${OWRT_HOST}:${OWRT_TEMP}" ssh "${OWRT_USER}@${OWRT_HOST}" "opkg install ${OWRT_TEMP}/*.ipk" ssh "${OWRT_USER}@${OWRT_HOST}" "rm -f -R ${OWRT_TEMP}" rm -f -R "${OWRT_TEMP}" 参考 LuCI is developed at GitHub LuCI 问题跟踪 LuCI documentation wiki 通过 SSH 隧道安全访问LuCI LuCI 技术参考 LuCI Themes and how to change them This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有